package day03;

import java.sql.SQLOutput;
import java.time.Year;
import java.util.Scanner;

public class Bank {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        for (; ; ) {
            System.out.println("存几年？");
            int year = sc.nextInt();
            System.out.println("输入本金");
            double money = sc.nextDouble();
            if (money >= 1000 && Rate(year) != 0) {
                System.out.println(year + "年后，本息一共" +(year * (Rate(year)) * money + money));
                break;
            } else {
                System.out.println("输入格式不对，重新输");
            }
        }
    }

    public static double Rate(int year) {
        if (year < 1 || year > 5 || year == 4) {
            return 0;
        }

        switch (year) {
            case 1:
                return 0.0225;

            case 2:
                return 0.027;

            case 3:
                return 0.0325;

            case 5:
                return 0.036;
        }
        return 0;
    }
}

